import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";

export default defineConfig({
  plugins: [react()],
  resolve: {
    extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"], // 确保包含 .jsx
    alias: {
      "@": path.resolve(__dirname, "./src"), // 设置 @ 指向 src 目录
    },
  },
  // 配置代理
  server: {
    proxy: {
      "/res": {
        target: "http://127.0.0.1:7001",
        changeOrigin: true,
      },
      "/api": {
        target: "http://127.0.0.1:7001",
        changeOrigin: true,
      },
      "/static": {
        target: "http://127.0.0.1:7001",
        changeOrigin: true,
      },
    },
  },
});
